# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
pkgname=slang
pkgver=2.3.3
pkgrel=3
pkgdesc="Powerful interpreted language"
url="https://www.jedsoft.org/slang"
arch="all"
license="GPL-2.0-or-later"
makedepends="
	libpng-dev
	ncurses-dev
	oniguruma-dev
	zlib-dev
	"
subpackages="
	$pkgname-static
	$pkgname-dev
	$pkgname-doc
	$pkgname-oniguruma
	$pkgname-png
	$pkgname-zlib
	"
source="https://www.jedsoft.org/releases/slang/slang-$pkgver.tar.bz2
	disable-rpath.patch
	terminfo-in-etc.patch
	skip-slsh-process-test.patch
	"

build() {
	./configure \
		--build=$CBUILD \
		--host=$CHOST \
		--prefix=/usr \
		--sysconfdir=/etc \
		--mandir=/usr/share/man \
		--localstatedir=/var \
		--without-pcre \
		--with-zlib=/usr/lib \
		--with-zinc=/usr/include
	make -j1
}

check() {
	make check
}

package() {
	make -j1 DESTDIR="$pkgdir" install-all
}

oniguruma() {
	pkgdesc="$pkgdesc (oniguruma module)"

	amove usr/lib/slang/v2/modules/onig-module.so
}

png() {
	pkgdesc="$pkgdesc (png module)"

	amove usr/lib/slang/v2/modules/png-module.so
}

zlib() {
	pkgdesc="$pkgdesc (zlib module)"

	amove usr/lib/slang/v2/modules/zlib-module.so
}

sha512sums="
f882f09e3fcd53427de0f233c9fc3ab15497f2323007be9a084696c8cf810ffe2726cd003149e757df26198b390b9f8c1ff411dc6473513457bd0f94722f8490  slang-2.3.3.tar.bz2
0cb78c65faade7cb1ec683ba3ae84d7514df7af92a465a6af262979b43ae86bdd9fd289c9680e9158a0b01e2df4ddaa7c547d9707afc3c3b75d798f2225cbc0f  disable-rpath.patch
a9fe12d220ec3458932784f1f7d40816cad9664ad5a3e19fe684e8f32eccc67ffc48acfa9852fccbe6741519f2acadbafc4b72817ae70804f93e2d913831d786  terminfo-in-etc.patch
4a499a61a0abf119a362c46e761a4cd659a0de03f22acd2004a09fce339cde848f114a3a0beca176e3a42beeb8d0d2cd73ba788ccb01330b741afe9d8528164c  skip-slsh-process-test.patch
"
